package com.chanjiedata.changbs.adapter;

import android.content.Context;
import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chanjiedata.changbs.R;
import com.chanjiedata.changbs.help.GlideHelper;
import com.chanjiedata.changbs.proto.Mystock;

import java.util.List;

/**
 * 文件名 : ProgressAdapter
 * 创建者 : MangoWang
 * 创建日期 : 2019/11/25 11:50
 * 微信 : MangoWaWang
 * 邮箱 : 763482205@qq.com
 * 描述 : TODO
 */

public class NoActMachineAdapter extends BaseQuickAdapter<Mystock.myMachineToolsList.List, BaseViewHolder> {
    public NoActMachineAdapter(Context context, List<Mystock.myMachineToolsList.List> dataList) {
        super(R.layout.item_machine, dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mystock.myMachineToolsList.List item) {
        GlideHelper.INSTANCE.loadImage(helper.getView(R.id.iv_good_icon), item.getGoodsImage());
        helper.setText(R.id.tv_good_name, item.getGoodsName() + item.getGoodsSerial())
                .setText(R.id.tv_sn_number, item.getSnCode())
                .setText(R.id.tv_time, item.getAssessTime())
                .setText(R.id.tv_price, "¥" + item.getGoodsPrice());
        if (item.getIsActivation().equals("1")) {
            helper.setText(R.id.tv_action, "激活考核时间：");
        } else {
            helper.setText(R.id.tv_action, "激活考核时间：");
        }


        switch (item.getAssessState()) {
            case "0":
                helper.setText(R.id.tv_time_statue, "安全期")
                        .setTextColor(R.id.tv_time_statue, Color.parseColor("#00692F"));
                break;
            case "1":
                helper.setText(R.id.tv_time_statue, "将到期")
                        .setTextColor(R.id.tv_time_statue, Color.parseColor("#E26955"));
                break;
            case "2":
                helper.setText(R.id.tv_time_statue, "已过期")
                        .setTextColor(R.id.tv_time_statue, Color.parseColor("#898989"));
                break;
        }


    }
}